package itsm.isperp.workflow.web.controller;

import java.sql.SQLException;

import itsm.isperp.framework.web.response.ResultMessage;
import itsm.isperp.workflow.utils.AutoJumpToActivityUtil;

import org.activiti.engine.RepositoryService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 流程控制器
 * 
 * @author lizx
 * @date 2013-3-15
 */
@Controller
@RequestMapping("workflow/process")
public class ProcessController {

	protected Logger logger = LoggerFactory.getLogger(getClass());

	@Autowired
	RepositoryService repositoryService;

	@RequestMapping(value = "autoJump")
	@ResponseBody
	public ResultMessage autoJump() {

		try {

			AutoJumpToActivityUtil.jumpTo();
		} catch (SQLException e) {
			return ResultMessage.failure(e);
		}

		return ResultMessage.success();
	}

}
